﻿using System.ComponentModel.DataAnnotations;

namespace Huasky.MyWrod.Core.Db;

/// <summary>
/// 实体数据
/// </summary>
public class DbEntity
{
    private Guid? _id;

    [Key]
    public Guid Id
    {
        get => _id ??= Guid.NewGuid();
        set => _id = value;
    }

    /// <summary>
    /// 是否删除 （标记删除）
    /// </summary>
    public bool IsDelete { get; set; }

    private DateTimeOffset? _createdTime;
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTimeOffset CreatedTime
    {
        get => _createdTime ??= DateTimeOffset.Now;
        set => _createdTime = value;
    }
}


/// <summary>
/// 包含JSON属性的实体数据
/// </summary>
public class JsonEntity: DbEntity
{
    public string JsonExt { get; set; }
}
